﻿using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
@TestRunner.Imports


namespace @Test.Namespace
{
	
	public partial class @Test.ClassName
	{

        @Tag("Exception")
    	@TestAttribute
		public void @(Test.ClassName + "_Exception_Serializer")()
		{
			var objectUnderTest = CreateObject();

			var formatter = new BinaryFormatter();
			var stream = new MemoryStream();
			formatter.Serialize(stream, objectUnderTest);
			stream.Seek(0, SeekOrigin.Begin);

			var newObject = (@Class.FullName)formatter.Deserialize(stream);
			Assert.AreEqual(objectUnderTest.Message, newObject.Message, "Message is incorrect.");
		}

	public partial class @Test.ClassName
	{

        @Tag("Exception")
    	@TestAttribute
		public void @(Test.ClassName + "_Exception_DataContractSerializer")()
		{
			var objectUnderTest = CreateObject();

			var stream = new MemoryStream();
			var serializer = new DataContractSerializer(typeof(@Class.FullName));
			serializer.WriteObject(stream, objectUnderTest);
			stream.Seek(0, SeekOrigin.Begin);

			var result = (@Class.FullName)serializer.ReadObject(stream);
			Assert.AreEqual(objectUnderTest.Message, newObject.Message, "Message is incorrect.");
		}

	}
}

